package org.framework.edge.builder.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.framework.edge.builder.application.command.docker.repository.DockerRepositoryBackupsCommand;
import org.framework.edge.builder.domain.model.docker.repository.DockerRepository;
import org.wu.framework.web.spring.EasyController;
import org.springframework.web.bind.annotation.*;
import org.wu.framework.web.response.Result;
import org.wu.framework.web.response.ResultFactory;
import org.springframework.beans.factory.annotation.Autowired;
import jakarta.annotation.Resource;
import java.util.List;
import org.framework.edge.builder.domain.model.docker.repository.backup.DockerRepositoryBackup;
import org.framework.edge.builder.application.command.docker.repository.backup.DockerRepositoryBackupRemoveCommand;
import org.framework.edge.builder.application.command.docker.repository.backup.DockerRepositoryBackupStoryCommand;
import org.framework.edge.builder.application.command.docker.repository.backup.DockerRepositoryBackupUpdateCommand;
import org.framework.edge.builder.application.command.docker.repository.backup.DockerRepositoryBackupQueryListCommand;
import org.framework.edge.builder.application.command.docker.repository.backup.DockerRepositoryBackupQueryOneCommand;
import org.framework.edge.builder.application.DockerRepositoryBackupApplication;
import org.framework.edge.builder.application.dto.DockerRepositoryBackupDTO;
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
import org.framework.edge.builder.application.command.docker.repository.backup.DockerRepositoryBackupExcelExport;
import org.framework.edge.builder.application.command.docker.repository.backup.DockerRepositoryBackupExcelImport;
import org.wu.framework.easy.excel.stereotype.RequestExcelBody;
import org.wu.framework.easy.excel.stereotype.EasyExcel;
/**
 * describe Docker仓库备份 
 *
 * @author Jia wei Wu
 * @date 2025/07/10 08:18 晚上
 * @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyController 
 **/
@Tag(name = "Docker仓库备份提供者")
@EasyController("/docker/repository/backup")
public class DockerRepositoryBackupProvider  {

    @Resource
    private DockerRepositoryBackupApplication dockerRepositoryBackupApplication;

    /**
     * describe 新增Docker仓库备份
     *
     * @param dockerRepositoryBackupStoryCommand 新增Docker仓库备份     
     * @return {@link Result<DockerRepositoryBackup>} Docker仓库备份新增后领域对象     
     
     * @author Jia wei Wu
     * @date 2025/07/10 08:18 晚上
     **/

    @Operation(summary = "新增Docker仓库备份")
    @PostMapping("/story")
    public Result<DockerRepositoryBackup> story(@RequestBody DockerRepositoryBackupStoryCommand dockerRepositoryBackupStoryCommand){
        return dockerRepositoryBackupApplication.story(dockerRepositoryBackupStoryCommand);
    }
    /**
     * describe 批量新增Docker仓库备份
     *
     * @param dockerRepositoryBackupStoryCommandList 批量新增Docker仓库备份     
     * @return {@link Result<List<DockerRepositoryBackup>>} Docker仓库备份新增后领域对象集合     
     
     * @author Jia wei Wu
     * @date 2025/07/10 08:18 晚上
     **/

    @Operation(summary = "批量新增Docker仓库备份")
    @PostMapping("/batchStory")
    public Result<List<DockerRepositoryBackup>> batchStory(@RequestBody List<DockerRepositoryBackupStoryCommand> dockerRepositoryBackupStoryCommandList){
        return dockerRepositoryBackupApplication.batchStory(dockerRepositoryBackupStoryCommandList);
    }
    /**
     * describe 更新Docker仓库备份
     *
     * @param dockerRepositoryBackupUpdateCommand 更新Docker仓库备份     
     * @return {@link Result<DockerRepositoryBackup>} Docker仓库备份领域对象     
     
     * @author Jia wei Wu
     * @date 2025/07/10 08:18 晚上
     **/

    @Operation(summary = "更新Docker仓库备份")
    @PutMapping("/updateOne")
    public Result<DockerRepositoryBackup> updateOne(@RequestBody DockerRepositoryBackupUpdateCommand dockerRepositoryBackupUpdateCommand){
        return dockerRepositoryBackupApplication.updateOne(dockerRepositoryBackupUpdateCommand);
    }
    /**
     * describe 查询单个Docker仓库备份
     *
     * @param dockerRepositoryBackupQueryOneCommand 查询单个Docker仓库备份     
     * @return {@link Result<DockerRepositoryBackupDTO>} Docker仓库备份DTO对象     
     
     * @author Jia wei Wu
     * @date 2025/07/10 08:18 晚上
     **/

    @Operation(summary = "查询单个Docker仓库备份")
    @GetMapping("/findOne")
    public Result<DockerRepositoryBackupDTO> findOne(@ModelAttribute DockerRepositoryBackupQueryOneCommand dockerRepositoryBackupQueryOneCommand){
        return dockerRepositoryBackupApplication.findOne(dockerRepositoryBackupQueryOneCommand);
    }
    /**
     * describe 查询多个Docker仓库备份
     *
     * @param dockerRepositoryBackupQueryListCommand 查询多个Docker仓库备份     
     * @return {@link Result<List<DockerRepositoryBackupDTO>>} Docker仓库备份DTO对象     
     
     * @author Jia wei Wu
     * @date 2025/07/10 08:18 晚上
     **/

    @Operation(summary = "查询多个Docker仓库备份")
    @GetMapping("/findList")
    public Result<List<DockerRepositoryBackupDTO>> findList(@ModelAttribute DockerRepositoryBackupQueryListCommand dockerRepositoryBackupQueryListCommand){
        return dockerRepositoryBackupApplication.findList(dockerRepositoryBackupQueryListCommand);
    }
    /**
     * describe 分页查询多个Docker仓库备份
     *
     * @param dockerRepositoryBackupQueryListCommand 分页查询多个Docker仓库备份     
     * @return {@link Result<LazyPage<DockerRepositoryBackupDTO>>} 分页Docker仓库备份DTO对象     
     
     * @author Jia wei Wu
     * @date 2025/07/10 08:18 晚上
     **/

    @Operation(summary = "分页查询多个Docker仓库备份")
    @GetMapping("/findPage")
    public Result<LazyPage<DockerRepositoryBackupDTO>> findPage(@Parameter(description ="分页大小") @RequestParam(defaultValue = "10", value = "size") int size,
                           @Parameter(description ="当前页数") @RequestParam(defaultValue = "1", value = "current") int current,@ModelAttribute DockerRepositoryBackupQueryListCommand dockerRepositoryBackupQueryListCommand){
        return dockerRepositoryBackupApplication.findPage(size,current,dockerRepositoryBackupQueryListCommand);
    }
    /**
     * describe 删除Docker仓库备份
     *
     * @param dockerRepositoryBackupRemoveCommand 删除Docker仓库备份     
     * @return {@link Result<DockerRepositoryBackup>} Docker仓库备份     
     
     * @author Jia wei Wu
     * @date 2025/07/10 08:18 晚上
     **/

    @Operation(summary = "删除Docker仓库备份")
    @DeleteMapping("/remove")
    public Result<DockerRepositoryBackup> remove(@ModelAttribute DockerRepositoryBackupRemoveCommand dockerRepositoryBackupRemoveCommand){
        return dockerRepositoryBackupApplication.remove(dockerRepositoryBackupRemoveCommand);
    }
    /**
     * describe 导出Docker仓库备份
     *
     * @param dockerRepositoryBackupQueryListCommand 导出Docker仓库备份     
     * @return {@link List<DockerRepositoryBackupExcelExport>} Docker仓库备份     
     
     * @author Jia wei Wu
     * @date 2025/07/10 08:18 晚上
     **/

    @EasyExcel(fileName = "导出Docker仓库备份数据")
    @Operation(summary = "导出Docker仓库备份")
    @GetMapping("/exportExcel")
    public List<DockerRepositoryBackupExcelExport> exportExcel(@ModelAttribute DockerRepositoryBackupQueryListCommand dockerRepositoryBackupQueryListCommand){
        return dockerRepositoryBackupApplication.exportExcel(dockerRepositoryBackupQueryListCommand);
    }
    /**
     * describe 导出模版Docker仓库备份
     *
     
     * @return {@link Result<List<DockerRepositoryBackupExcelExport>>} Docker仓库备份     
     
     * @author Jia wei Wu
     * @date 2025/07/10 08:18 晚上
     **/

    @EasyExcel(fileName = "导出Docker仓库备份模版数据")
    @Operation(summary = "导出Docker仓库备份模版")
    @GetMapping("/exportTemplateExcel")
    public List<DockerRepositoryBackupExcelExport> exportTemplateExcel(){
        return List.of(new DockerRepositoryBackupExcelExport());
    }
    /**
     * describe 导入Docker仓库备份
     *
     * @param dockerRepositoryBackupExcelImportList 导入Docker仓库备份     
     * @return {@link Result<DockerRepositoryBackupExcelImport>} Docker仓库备份     
     
     * @author Jia wei Wu
     * @date 2025/07/10 08:18 晚上
     **/

    @Operation(summary = "导入Docker仓库备份")
    @PostMapping("/importExcel")
    public Result<List<DockerRepositoryBackupExcelImport>> importExcel(@RequestExcelBody("multipartFile") List<DockerRepositoryBackupExcelImport> dockerRepositoryBackupExcelImportList){
        return dockerRepositoryBackupApplication.importExcel(dockerRepositoryBackupExcelImportList);
    }

    /**
     * describe 仓库备份
     *
     * @param dockerRepositoryBackupsCommand 更新Docker 仓库
     * @return {@link Result< DockerRepository >} Docker 仓库领域对象

     * @author Jia wei Wu
     * @date 2024/08/13 07:39 晚上
     **/

    @Operation(summary = "仓库备份")
    @PutMapping("/backups")
    public Result<DockerRepository> backups(@RequestBody DockerRepositoryBackupsCommand dockerRepositoryBackupsCommand){
        return dockerRepositoryBackupApplication.backups(dockerRepositoryBackupsCommand);
    }
}